```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>垃圾收集算法深度解析</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            line-height: 1.6;
            color: #333;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .highlight {
            position: relative;
            z-index: 1;
        }
        .highlight:after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 30%;
            background-color: rgba(118, 75, 162, 0.2);
            z-index: -1;
            transition: all 0.3s ease;
        }
        .highlight:hover:after {
            height: 100%;
        }
        .timeline-item:before {
            content: '';
            position: absolute;
            left: -1.5rem;
            top: 0;
            height: 100%;
            width: 2px;
            background: #667eea;
        }
        .timeline-dot {
            position: absolute;
            left: -1.75rem;
            top: 0.5rem;
            width: 0.75rem;
            height: 0.75rem;
            border-radius: 50%;
            background: #764ba2;
            border: 2px solid #667eea;
        }
        .algorithm-card {
            transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        }
        .algorithm-card:hover {
            box-shadow: 0 14px 28px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.08);
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl text-center">
            <div class="flex justify-center mb-6">
                <div class="bg-white bg-opacity-20 rounded-full p-3 inline-flex items-center justify-center">
                    <i class="fas fa-recycle text-2xl"></i>
                </div>
            </div>
            <h1 class="text-4xl md:text-5xl font-bold mb-6">垃圾收集算法深度解析</h1>
            <p class="text-xl md:text-2xl opacity-90 max-w-3xl mx-auto leading-relaxed">
                探索现代垃圾收集器的核心原理、设计哲学与性能权衡
            </p>
            <div class="mt-10">
                <a href="#content" class="inline-block bg-white text-purple-800 font-semibold px-6 py-3 rounded-full hover:bg-opacity-90 transition-all duration-300 transform hover:-translate-y-1">
                    开始探索 <i class="fas fa-arrow-down ml-2"></i>
                </a>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main id="content" class="container mx-auto max-w-5xl px-4 py-16">
        <!-- Introduction -->
        <section class="mb-20">
            <div class="bg-white rounded-xl shadow-md p-8">
                <h2 class="text-3xl font-bold mb-6 text-gray-800">垃圾收集算法概述</h2>
                <p class="text-lg text-gray-700 mb-6">
                    垃圾收集算法是现代编程语言运行时环境的核心组件，它们负责自动管理内存分配和回收，解放开发者手动管理内存的负担。
                </p>
                <p class="text-lg text-gray-700">
                    每种垃圾收集算法有其特定的设计目标和适用场景。选择合适的垃圾收集算法需要根据应用程序的性能需求、内存使用情况和系统资源等因素综合考虑。
                </p>
            </div>
        </section>

        <!-- Algorithm Cards -->
        <section class="mb-20">
            <h2 class="text-3xl font-bold mb-10 text-center text-gray-800">主流垃圾收集算法</h2>
            
            <div class="grid md:grid-cols-2 gap-8">
                <!-- Card 1: Mark-Sweep -->
                <div class="algorithm-card bg-white rounded-lg overflow-hidden shadow-md border-l-4 border-blue-500 hover:border-purple-600">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="bg-blue-100 p-3 rounded-full mr-4">
                                <i class="fas fa-broom text-blue-600 text-xl"></i>
                            </div>
                            <h3 class="text-2xl font-bold text-gray-800">标记-清除算法</h3>
                        </div>
                        <div class="pl-16">
                            <h4 class="font-semibold text-gray-700 mb-2">过程：</h4>
                            <ol class="list-decimal pl-5 text-gray-600 mb-4 space-y-1">
                                <li><strong>标记阶段</strong>：从 GC Roots 开始，标记所有可以访问到的对象</li>
                                <li><strong>清除阶段</strong>：遍历整个堆，将未标记的对象回收</li>
                            </ol>
                            <h4 class="font-semibold text-gray-700 mb-2">特点：</h4>
                            <div class="grid grid-cols-2 gap-2">
                                <div class="bg-green-50 p-3 rounded-lg">
                                    <p class="text-sm font-medium text-green-800 flex items-center">
                                        <i class="fas fa-check-circle mr-2"></i> 优点
                                    </p>
                                    <p class="text-sm text-gray-600 mt-1">简单易实现</p>
                                    <p class="text-sm text-gray-600">对象回收直接</p>
                                </div>
                                <div class="bg-red-50 p-3 rounded-lg">
                                    <p class="text-sm font-medium text-red-800 flex items-center">
                                        <i class="fas fa-exclamation-circle mr-2"></i> 缺点
                                    </p>
                                    <p class="text-sm text-gray-600 mt-1">内存碎片化</p>
                                    <p class="text-sm text-gray-600">停顿时间长</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Card 2: Mark-Compact -->
                <div class="algorithm-card bg-white rounded-lg overflow-hidden shadow-md border-l-4 border-green-500 hover:border-purple-600">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="bg-green-100 p-3 rounded-full mr-4">
                                <i class="fas fa-compress-alt text-green-600 text-xl"></i>
                            </div>
                            <h3 class="text-2xl font-bold text-gray-800">标记-整理算法</h3>
                        </div>
                        <div class="pl-16">
                            <h4 class="font-semibold text-gray-700 mb-2">过程：</h4>
                            <ol class="list-decimal pl-5 text-gray-600 mb-4 space-y-1">
                                <li><strong>标记阶段</strong>：从 GC Roots 开始，标记所有可以访问到的对象</li>
                                <li><strong>整理阶段</strong>：将标记的对象移动到内存的一端</li>
                            </ol>
                            <h4 class="font-semibold text-gray-700 mb-2">特点：</h4>
                            <div class="grid grid-cols-2 gap-2">
                                <div class="bg-green-50 p-3 rounded-lg">
                                    <p class="text-sm font-medium text-green-800 flex items-center">
                                        <i class="fas fa-check-circle mr-2"></i> 优点
                                    </p>
                                    <p class="text-sm text-gray-600 mt-1">消除内存碎片</p>
                                </div>
                                <div class="bg-red-50 p-3 rounded-lg">
                                    <p class="text-sm font-medium text-red-800 flex items-center">
                                        <i class="fas fa-exclamation-circle mr-2"></i> 缺点
                                    </p>
                                    <p class="text-sm text-gray-600 mt-1">移动对象开销大</p>
                                    <p class="text-sm text-gray-600">停顿时间长</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Card 3: Copying -->
                <div class="algorithm-card bg-white rounded-lg overflow-hidden shadow-md border-l-4 border-yellow-500 hover:border-purple-600">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="bg-yellow-100 p-3 rounded-full mr-4">
                                <i class="fas fa-copy text-yellow-600 text-xl"></i>
                            </div>
                            <h3 class="text-2xl font-bold text-gray-800">复制算法</h3>
                        </div>
                        <div class="pl-16">
                            <h4 class="font-semibold text-gray-700 mb-2">过程：</h4>
                            <ol class="list-decimal pl-5 text-gray-600 mb-4 space-y-1">
                                <li><strong>分代</strong>：将内存分为活动区域和空闲区域</li>
                                <li><strong>复制阶段</strong>：将活动区域的对象复制到空闲区域</li>
                            </ol>
                            <h4 class="font-semibold text-gray-700 mb-2">特点：</h4>
                            <div class="grid grid-cols-2 gap-2">
                                <div class="bg-green-50 p-3 rounded-lg">
                                    <p class="text-sm font-medium text-green-800 flex items-center">
                                        <i class="fas fa-check-circle mr-2"></i> 优点
                                    </p>
                                    <p class="text-sm text-gray-600 mt-1">高效回收</p>
                                    <p class="text-sm text-gray-600">减少碎片</p>
                                </div>
                                <div class="bg-red-50 p-3 rounded-lg">
                                    <p class="text-sm font-medium text-red-800 flex items-center">
                                        <i class="fas fa-exclamation-circle mr-2"></i> 缺点
                                    </p>
                                    <p class="text-sm text-gray-600 mt-1">内存消耗大</p>
                                    <p class="text-sm text-gray-600">适用场景有限</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Card 4: Generational Collection -->
                <div class="algorithm-card bg-white rounded-lg overflow-hidden shadow-md border-l-4 border-purple-500 hover:border-purple-600">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <div class="bg-purple-100 p-3 rounded-full mr-4">
                                <i class="fas fa-layer-group text-purple-600 text-xl"></i>
                            </div>
                            <h3 class="text-2xl font-bold text-gray-800">分代收集算法</h3>
                        </div>
                        <div class="pl-16">
                            <h4 class="font-semibold text-gray-700 mb-2">过程：</h4>
                            <ul class="list-disc pl-5 text-gray-600 mb-4 space-y-1">
                                <li><strong>年轻代</strong>：使用复制算法</li>
                                <li><strong>老年代</strong>：使用标记-清除或标记-整理算法</li>
                            </ul>
                            <h4 class="font-semibold text-gray-700 mb-2">特点：</h4>
                            <div class="grid grid-cols-2 gap-2">
                                <div class="bg-green-50 p-3 rounded-lg">
                                    <p class="text-sm font-medium text-green-800 flex items-center">
                                        <i class="fas fa-check-circle mr-2"></i> 优点
                                    </p>
                                    <p class="text-sm text-gray-600 mt-1">提高效率</p>
                                    <p class="text-sm text-gray-600">减少回收频率</p>
                                </div>
                                <div class="bg-red-50 p-3 rounded-lg">
                                    <p class="text-sm font-medium text-red-800 flex items-center">
                                        <i class="fas fa-exclamation-circle mr-2"></i> 缺点
                                    </p>
                                    <p class="text-sm text-gray-600 mt-1">实现复杂</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Advanced Algorithms -->
        <section class="mb-20">
            <h2 class="text-3xl font-bold mb-10 text-center text-gray-800">高级垃圾收集算法</h2>
            
            <!-- Timeline -->
            <div class="relative">
                <!-- CMS -->
                <div class="timeline-item relative pl-10 mb-12">
                    <div class="timeline-dot"></div>
                    <div class="bg-white p-6 rounded-xl shadow-md">
                        <div class="flex items-center mb-4">
                            <div class="bg-indigo-100 p-3 rounded-full mr-4">
                                <i class="fas fa-bolt text-indigo-600 text-xl"></i>
                            </div>
                            <h3 class="text-2xl font-bold text-gray-800">并发标记-清除算法 (CMS)</h3>
                        </div>
                        <div class="pl-16">
                            <h4 class="font-semibold text-gray-700 mb-2">过程：</h4>
                            <ol class="list-decimal pl-5 text-gray-600 mb-4 space-y-1">
                                <li><strong>初始标记</strong>：短暂停顿，标记GC Roots直接可达对象</li>
                                <li><strong>并发标记</strong>：与应用线程并发执行</li>
                                <li><strong>重新标记</strong>：短暂停顿，修正并发标记期间的变化</li>
                                <li><strong>并发清除</strong>：与应用线程并发执行</li>
                            </ol>
                            <h4 class="font-semibold text-gray-700 mb-2">特点：</h4>
                            <div class="grid grid-cols-2 gap-4">
                                <div class="bg-green-50 p-4 rounded-lg">
                                    <p class="text-sm font-medium text-green-800 flex items-center">
                                        <i class="fas fa-check-circle mr-2"></i> 优点
                                    </p>
                                    <p class="text-sm text-gray-600 mt-2">减少停顿时间</p>
                                </div>
                                <div class="bg-red-50 p-4 rounded-lg">
                                    <p class="text-sm font-medium text-red-800 flex items-center">
                                        <i class="fas fa-exclamation-circle mr-2"></i> 缺点
                                    </p>
                                    <p class="text-sm text-gray-600 mt-2">内存碎片问题</p>
                                    <p class="text-sm text-gray-600">CPU资源消耗大</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- G1 -->
                <div class="timeline-item relative pl-10 mb-12">
                    <div class="timeline-dot"></div>
                    <div class="bg-white p-6 rounded-xl shadow-md">
                        <div class="flex items-center mb-4">
                            <div class="bg-pink-100 p-3 rounded-full mr-4">
                                <i class="fas fa-chess-board text-pink-600 text-xl"></i>
                            </div>
                            <h3 class="text-2xl font-bold text-gray-800">G1 垃圾收集器</h3>
                        </div>
                        <div class="pl-16">
                            <h4 class="font-semibold text-gray-700 mb-2">过程：</h4>
                            <ol class="list-decimal pl-5 text-gray-600 mb-4 space-y-1">
                                <li><strong>分区</strong>：将堆划分为多个区域</li>
                                <li><strong>增量标记</strong>：标记活动对象</li>
                                <li><strong>回收阶段</strong>：根据目标停顿时间选择回收区域</li>
                            </ol>
                            <h4 class="font-semibold text-gray-700 mb-2">特点：</h4>
                            <div class="grid grid-cols-2 gap-4">
                                <div class="bg-green-50 p-4 rounded-lg">
                                    <p class="text-sm font-medium text-green-800 flex items-center">
                                        <i class="fas fa-check-circle mr-2"></i> 优点
                                    </p>
                                    <p class="text-sm text-gray-600 mt-2">低延迟</p>
                                    <p class="text-sm text-gray-600">解决内存碎片</p>
                                </div>
                                <div class="bg-red-50 p-4 rounded-lg">
                                    <p class="text-sm font-medium text-red-800 flex items-center">
                                        <i class="fas fa-exclamation-circle mr-2"></i> 缺点
                                    </p>
                                    <p class="text-sm text-gray-600 mt-2">配置复杂</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- ZGC -->
                <div class="timeline-item relative pl-10 mb-12">
                    <div class="timeline-dot"></div>
                    <div class="bg-white p-6 rounded-xl shadow-md">
                        <div class="flex items-center mb-4">
                            <div class="bg-teal-100 p-3 rounded-full mr-4">
                                <i class="fas fa-infinity text-teal-600 text-xl"></i>
                            </div>
                            <h3 class="text-2xl font-bold text-gray-800">Z 垃圾收集器 (ZGC)</h3>
                        </div>
                        <div class="pl-16">
                            <h4 class="font-semibold text-gray-700 mb-2">过程：</h4>
                            <p class="text-gray-600 mb-4">
                                通过并发标记、并发整理实现几乎零停顿的垃圾回收
                            </p>
                            <h4 class="font-semibold text-gray-700 mb-2">特点：</h4>
                            <div class="grid grid-cols-2 gap-4">
                                <div class="bg-green-50 p-4 rounded-lg">
                                    <p class="text-sm font-medium text-green-800 flex items-center">
                                        <i class="fas fa-check-circle mr-2"></i> 优点
                                    </p>
                                    <p class="text-sm text-gray-600 mt-2">极低延迟</p>
                                    <p class="text-sm text-gray-600">适用于大规模内存</p>
                                </div>
                                <div class="bg-red-50 p-4 rounded-lg">
                                    <p class="text-sm font-medium text-red-800 flex items-center">
                                        <i class="fas fa-exclamation-circle mr-2"></i> 缺点
                                    </p>
                                    <p class="text-sm text-gray-600 mt-2">资源消耗大</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Shenandoah -->
                <div class="timeline-item relative pl-10">
                    <div class="timeline-dot"></div>
                    <div class="bg-white p-6 rounded-xl shadow-md">
                        <div class="flex items-center mb-4">
                            <div class="bg-orange-100 p-3 rounded-full mr-4">
                                <i class="fas fa-mountain text-orange-600 text-xl"></i>
                            </div>
                            <h3 class="text-2xl font-bold text-gray-800">Shenandoah 垃圾收集器</h3>
                        </div>
                        <div class="pl-16">
                            <h4 class="font-semibold text-gray-700 mb-2">过程：</h4>
                            <p class="text-gray-600 mb-4">
                                并发进行标记、清除和整理，最大限度减少停顿时间
                            </p>
                            <h4 class="font-semibold text-gray-700 mb-2">特点：</h4>
                            <div class="grid grid-cols-2 gap-4">
                                <div class="bg-green-50 p-4 rounded-lg">
                                    <p class="text-sm font-medium text-green-800 flex items-center">
                                        <i class="fas fa-check-circle mr-2"></i> 优点
                                    </p>
                                    <p class="text-sm text-gray-600 mt-2">低停顿时间</p>
                                </div>
                                <div class="bg-red-50 p-4 rounded-lg">
                                    <p class="text-sm font-medium text-red-800 flex items-center">
                                        <i class="fas fa-exclamation-circle mr-2"></i> 缺点
                                    </p>
                                    <p class="text-sm text-gray-600 mt-2">配置复杂</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Visualization -->
        <section class="mb-20">
            <h2 class="text-3xl font-bold mb-10 text-center text-gray-800">垃圾收集算法对比</h2>
            
            <div class="bg-white rounded-xl shadow-md p-6">
                <div class="mermaid">
                    graph TD
                        A[垃圾收集算法] --> B[基本算法]
                        A --> C[高级算法]
                        B --> B1[标记-清除]
                        B --> B2[标记-整理]
                        B --> B3[复制算法]
                        C --> C1[分代收集]
                        C --> C2[并发标记清除 CMS]
                        C --> C3[G1]
                        C --> C4[ZGC]
                        C --> C5[Shenandoah]
                        
                        style A fill:#f0f9ff,stroke:#2563eb
                        style B fill:#f0fdf4,stroke:#16a34a
                        style C fill:#fef2f2,stroke:#dc2626
                </div>
            </div>
        </section>

        <!-- Selection Guide -->
        <section class="mb-20">
            <div class="bg-gradient-to-r from-purple-50 to-blue-50 rounded-xl shadow-md p-8">
                <h2 class="text-3xl font-bold mb-6 text-gray-800">如何选择合适的垃圾收集器？</h2>
                <div class="grid md:grid-cols-3 gap-6">
                    <div class="bg-white p-5 rounded-lg shadow-sm">
                        <div class="text-purple-600 text-2xl mb-3">
                            <i class="fas fa-tachometer-alt"></i>
                        </div>
                        <h3 class="font-bold text-lg mb-2">吞吐量优先</h3>
                        <p class="text-gray-600">
                            对吞吐量要求高的应用可以选择Parallel Scavenge+Parallel Old组合
                        </p>
                    </div>
                    <div class="bg-white p-5 rounded-lg shadow-sm">
                        <div class="text-blue-600 text-2xl mb-3">
                            <i class="fas fa-clock"></i>
                        </div>
                        <h3 class="font-bold text-lg mb-2">低延迟优先</h3>
                        <p class="text-gray-600">
                            对延迟敏感的应用可以选择CMS、G1或ZGC等低延迟收集器
                        </p>
                    </div>
                    <div class="bg-white p-5 rounded-lg shadow-sm">
                        <div class="text-green-600 text-2xl mb-3">
                            <i class="fas fa-memory"></i>
                        </div>
                        <h3 class="font-bold text-lg mb-2">大内存应用</h3>
                        <p class="text-gray-600">
                            超大堆内存(>4GB)应用建议使用G1或ZGC收集器
                        </p>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-10">
        <div class="container mx-auto max-w-5xl px-4">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-bold text-white mb-2">技术小馆</h3>
                    <p class="text-gray-400">探索技术之美，分享知识之光</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-gray-300 hover:text-white transition-colors duration-300 flex items-center">
                        <i class="fas fa-external-link-alt mr-2"></i> 访问技术小馆
                    </a>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-500 text-sm">
                &copy; 2023 技术小馆. 保留所有权利.
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>
```